
SRCNAME=nmgssl7
COMMONNAME=nmgssl

LUA_INCLUDE_DIR=
CMOD=$(COMMONNAME).so

OBJS= \
	$(SRCNAME).o

WARN=-Wall -pedantic

BSD_CFLAGS=-O2 -fPIC $(WARN) $(INCDIR) $(DEFS)
BSD_LDFLAGS=-O -fPIC -shared $(LIBDIR)

LNX_CFLAGS=-O2 -fPIC $(WARN) $(INCDIR) $(DEFS) -I/usr/local/ssl/include -I$(LUA_INCLUDE_DIR)
LNX_LDFLAGS=-O -fPIC -shared $(LIBDIR) -lssl -lcrypto

MAC_ENV=env MACOSX_DEPLOYMENT_TARGET='$(MACVER)'
MAC_CFLAGS=-O2 -fno-common $(WARN) $(INCDIR) $(DEFS)
MAC_LDFLAGS=-bundle -undefined dynamic_lookup $(LIBDIR)

INSTALL	?= install
CC	?= cc
LD	?= $(MYENV) cc
CFLAGS	+= $(MYCFLAGS)
LDFLAGS	+= $(MYLDFLAGS)
DESTDIR	?= /

linux:
	@$(MAKE) $(CMOD) MYCFLAGS="$(LNX_CFLAGS)" MYLDFLAGS="$(LNX_LDFLAGS)" EXTRA="$(EXTRA)"

$(CMOD): $(EXTRA) $(OBJS)
	$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)	
	
clean:
	rm -f $(OBJS) $(CMOD)

$(SRCNAME).o: $(SRCNAME).c